import json


class Tools_unitest():
    @classmethod
    def assert_tools(cls, self, resp, status_code, success, code, message):
        self.assertEqual(status_code, resp.status_code)
        self.assertEqual(success, resp.json().get("success"))
        self.assertEqual(code, resp.json().get("code"))
        self.assertIn(message, resp.json().get("message"))

    # '''''''
    # 通用断言方法
    # ''''
    @classmethod
    # 读取json文件
    def build_data_tools(cls, file_path):
        file_path = "D:\mypython\ApiAutoTestFrameWork\data\data.json"
        with open(file_path, "r", encoding="utf8") as f:
            data_list = json.load(f)
            # 创建空列表
            case_data = []
            # 循环提取数据
            for data in data_list:
                # 转换为元组
                tmp = tuple(data.values())
                case_data.append(tmp)
            return case_data
    # @classmethod
    # def get_head_tools(cls):
